package app.x;

import java.util.Arrays;
import de.robv.android.xposed.*;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

/** Created by wuzhengu on 2019/04/02 */
public class TestModule implements IXposedHookLoadPackage
{
	@Override
	public void handleLoadPackage(XC_LoadPackage.LoadPackageParam param) throws Throwable {
		switch(param.packageName){
		case "wzg.xpose":
			XposedHelpers.findAndHookMethod(
					"app.ui.ActHome",
					param.classLoader,
					"test",
					String.class,
					new XC_MethodHook()
					{
						@Override
						protected void beforeHookedMethod(MethodHookParam param) throws Throwable{
							XposedBridge.log("开始劫持: "+Arrays.toString(param.args));
						}
						
						@Override
						protected void afterHookedMethod(MethodHookParam param) throws Throwable{
							Object result=param.getResult();
							param.setResult("hi");
							XposedBridge.log("完成劫持: "+result+" -> "+param.getResult());
						}
					});
			break;
		}
		
	}
}
